/**
 *
 */
Ext.define('vacake.controller.Main', {
    extend: 'Ext.app.Controller',
    config: {
        routes: {

        },
        refs: {
            mainView: 'mainView'
        },
        control: {
            mainView: {
                activeitemchange: function (tabPanel, tab, oldTab) {
                    Ext.Viewport.mask({xtype: 'loadmask', message: '加载数据中...' });
                    var mainView = this.getMainView();
                    if (tab!=0){
                        if (tab.config.itemId == 1) {

                        } else if (tab.config.itemId == 2) {

                        } else if (tab.config.itemId == 3) {
                            if (window.localStorage.getItem('app_Login_id') == null || window.localStorage.getItem('app_Login_name') == null ) {
                                Ext.Viewport.animateActiveItem('loginForm', {type: 'slide', direction: 'left'});
                                return false;
                            }
                        } else if (tab.config.itemId == 4) {
                            if (window.localStorage.getItem('app_Login_id') == null || window.localStorage.getItem('app_Login_name') == null) {
                                Ext.Viewport.animateActiveItem('loginForm', {type: 'slide', direction: 'left'});
                                return false;
                            }
                        } else if (tab.config.itemId == 5) {

                        }

                    }
                }
            }
        }
    }
});

